package com.mida.dms.knw.entity.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Date;
import java.util.List;


/**
 * 模型属性
 *
 * @author conyfrommars
 */
@Setter
@Getter
public class DtModelPropertyVo  implements Serializable {

    /**
     * serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * 数据元名称
     */
    @ApiModelProperty(value = "数据元名称", required = false)
    protected String name;

    /**
     * 短名
     */
    @ApiModelProperty(value = "短名", required = false)
    protected String shortName;


    /**
     * 数据元类型
     */
    @ApiModelProperty(value = "数据元类型", required = false)
    protected String dataTypeName;


    /**
     * 编码体系标识符
     */
    @ApiModelProperty(value = "编码体系标识符", required = false)
    protected String codingSystemIdentifier;

    /**
     * 编码体系名称
     */
    @ApiModelProperty(value = "编码体系名称", required = false)
    protected String codingSystemIdentifierName;

    /**
     * 值编码
     */
    @ApiModelProperty(value = "值编码", required = false)
    protected String dataSetCode;

    /**
     * 值含义
     */
    @ApiModelProperty(value = "值含义", required = false)
    protected String dataSetName;

    /**
     * 修改标识
     */
    protected List<String> list;

    /**
     * 编码体系是否有效
     */
    @ApiModelProperty(value = "编码体系是否有效", required = false)
    protected int num;

    /**
     * 数据元标识符
     */
    @ApiModelProperty(value = "数据元标识符", required = false)
    protected String identifier;

    /**
     * 数据元类型
     */
    @ApiModelProperty(value = "数据元类型", required = false)
    protected String dataTypeCode;

    /**
     * 模型英文
     */
    @ApiModelProperty(value = "模型英文", required = false)
    protected String modelEngName;

    /**
     * 模型中文
     */
    @ApiModelProperty(value = "模型中文", required = false)
    protected String modelChiName;

    /**
     * 版本
     */
    @ApiModelProperty(value = "版本", required = false)
    protected float version;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long soid;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long dataModelSoid;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long dataSourceSoid;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long codingSystemSoid;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isPrimaryKey;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isForeignKey;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isNull;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isEncrpytion;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isPrivate;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long status;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isDelete;

    private Date createDate;

    private Date updateDate;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long updateUser;

    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long psotion;


    /**
     * 默认值
     */
    private String defaultNumber;

    /**
     * 最大值
     */
    private Double maxMunber;

    /**
     * 最小值
     */
    private Double minMunber;

    /**
     * 数据元类型
     */
    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long dataType;

    /**
     * 备用字段1
     */
    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long cusmon1;

    /**
     * 备用字段2
     */
    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long cusmon2;

    private String format;

    //模型对比标志位
    @JsonSerialize(using= com.fasterxml.jackson.databind.ser.std.ToStringSerializer.class)
    private Long isChange=0L;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof DtModelPropertyVo)) return false;

        DtModelPropertyVo that = (DtModelPropertyVo) o;

        if (getDataSourceSoid() != null ? !getDataSourceSoid().equals(that.getDataSourceSoid()) : that.getDataSourceSoid() != null)
            return false;
        if (getCodingSystemSoid() != null ? !getCodingSystemSoid().equals(that.getCodingSystemSoid()) : that.getCodingSystemSoid() != null)
            return false;
        if (getIsPrimaryKey() != null ? !getIsPrimaryKey().equals(that.getIsPrimaryKey()) : (that.getIsPrimaryKey() != null && that.getIsPrimaryKey() != 0l) )
            return false;
        if (getIsForeignKey() != null ? !getIsForeignKey().equals(that.getIsForeignKey()) : (that.getIsForeignKey() != null && that.getIsForeignKey() != 0l))
            return false;
        if (getIsNull() != null ? !getIsNull().equals(that.getIsNull()) : (that.getIsNull() != null && that.getIsNull()!= 0l)) return false;
        if (getIsEncrpytion() != null ? !getIsEncrpytion().equals(that.getIsEncrpytion()) : (that.getIsEncrpytion() != null && that.getIsEncrpytion()!= 0l))
            return false;
        return getIsPrivate() != null ? getIsPrivate().equals(that.getIsPrivate()) : (that.getIsPrivate() == null || that.getIsPrivate() == 0l);
    }

    @Override
    public int hashCode() {
        int result = getDataSourceSoid() != null ? getDataSourceSoid().hashCode() : 0;
        result = 31 * result + (getCodingSystemSoid() != null ? getCodingSystemSoid().hashCode() : 0);
        result = 31 * result + (getIsPrimaryKey() != null ? getIsPrimaryKey().hashCode() : 0);
        result = 31 * result + (getIsForeignKey() != null ? getIsForeignKey().hashCode() : 0);
        result = 31 * result + (getIsNull() != null ? getIsNull().hashCode() : 0);
        result = 31 * result + (getIsEncrpytion() != null ? getIsEncrpytion().hashCode() : 0);
        result = 31 * result + (getIsPrivate() != null ? getIsPrivate().hashCode() : 0);
        return result;
    }
}